C     Legacy Fortran 77 code for testing
      PROGRAM LEGACY
      IMPLICIT REAL (A-H,O-Z)
      COMMON /DATBLK/ X, Y, Z
      DIMENSION A(100), B(100)
      
      WRITE(*,*) 'Legacy Fortran Program'
      
      X = 1.0
      Y = 2.0
      Z = 3.0
      
      DO 10 I = 1, 100
        A(I) = FLOAT(I)
        B(I) = A(I) * 2.0
   10 CONTINUE
      
      CALL SUBR1(A, B, 100)
      CALL SUBR2()
      
      GOTO 999
      
  100 WRITE(*,*) 'This should not execute'
      
  999 CONTINUE
      STOP
      END
      
C     Subroutine 1
      SUBROUTINE SUBR1(ARR1, ARR2, N)
      IMPLICIT REAL (A-H,O-Z)
      DIMENSION ARR1(N), ARR2(N)
      COMMON /DATBLK/ X, Y, Z
      
      SUM = 0.0
      DO 20 I = 1, N
        SUM = SUM + ARR1(I) + ARR2(I)
   20 CONTINUE
      
      WRITE(*,*) 'Sum = ', SUM
      RETURN
      END
      
C     Subroutine 2
      SUBROUTINE SUBR2()
      IMPLICIT REAL (A-H,O-Z)
      COMMON /DATBLK/ X, Y, Z
      
      RESULT = X + Y + Z
      WRITE(*,*) 'Common block result = ', RESULT
      RETURN
      END